package com.zhongshengnetwork.rightbe.wzt.view;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.PopupWindow;

import com.zhongshengnetwork.rightbe.Adv.model.AdvertUtils;
import com.zhongshengnetwork.rightbe.Adv.model.MyUriUtils;
import com.zhongshengnetwork.rightbe.Adv.model.SPManageUtils;
import com.zhongshengnetwork.rightbe.Constant.APIKey;
import com.zhongshengnetwork.rightbe.CustomApplication;
import com.zhongshengnetwork.rightbe.MainActivity;
import com.zhongshengnetwork.rightbe.R;
import com.zhongshengnetwork.rightbe.common.CommonUtils;

import pl.droidsonroids.gif.GifImageView;

public class LaunchPopWindow {

    private Context context;
    private String bgUr;
    private String jumpUrl;
    public PopupWindow popupWindow;

    public GifImageView advert_img;
    public Button delay_time_btn;

    public LaunchPopWindow(Context context, String bgUr, String jumpUrl){
        this.context = context;
        this.bgUr = bgUr;
        this.jumpUrl = jumpUrl;

        View view = LayoutInflater.from(context).inflate(R.layout.launch_pop, null);
        advert_img = (GifImageView) view.findViewById(R.id.advert_img);
        delay_time_btn = (Button) view.findViewById(R.id.delay_time_btn);
        if (!CommonUtils.isEmpty(bgUr)){
            advert_img.setImageURI(MyUriUtils.getUri(CustomApplication.mContext,bgUr));
        }

        popupWindow = new PopupWindow(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        // 这个是为了点击“返回Back”也能使其消失，并且并不会影响你的背景（很神奇的）
        popupWindow.setBackgroundDrawable(new BitmapDrawable());

    }

}
